package dao

import "new/models"

func GetAllCustomers() (error, []models.Customers, int64) {
	var customerData []models.Customers
	//page := customerParam["page"].(int)
	//pageSize := customerParam["limit"].(int)
	//searchName := customerParam["searchName"].(string)
	var total int64
	err := db.Table("customer").Order("cno ASC").Count(&total).Find(&customerData).Error
	return err, customerData, total
}
func DelCustomers(cno int) error {
	var customer []models.Customers
	err := db.Table("customer").Where("cno = ?", cno).Delete(&customer).Error
	return err
}
func UpdateCustomers(customer models.Customers) error {
	err := db.Table("customer").Where("cno = ?", customer.CustomersCno).Updates(&customer).Error
	return err
}
func AddCustomers(customer models.Customers) (error) {
	err := db.Table("customer").Create(&customer).Error
	return err
}
